import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:hive_flutter/hive_flutter.dart';
import 'core/app.dart'; // 移动端/PC端的应用组件
import 'core/app_initializer.dart';
import 'data/datasources/local/auth_local_data_source.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  // 初始化本地存储
  await Hive.initFlutter();

  // 初始化认证本地数据源
  final authLocalDataSource = AuthLocalDataSource();
  await authLocalDataSource.initialize();

  runApp(
    ProviderScope(
      overrides: [
        // 覆盖默认的authLocalDataSourceProvider，使用已初始化的实例
      ],
      child: AppInitializer(
        child: FlowPlanApp(), // 移动端/PC端的应用组件
      ),
    ),
  );
}
